import Cookie from 'js-cookie'
class CookieManager {
  /**
   * 设置cookie
   * @param key 键
   * @param value 值
   * @param time  过期时间，单位天
   */
  public static set(key: string, value: string, time?: number) {
    Cookie.set(key, value, { expires: time || 7 })
  }

  /**
   * 获取cookie
   * @param key 键
   * @returns string 值
   */
  public static get(key: string): string {
    return Cookie.get(key) || ''
  }

  /**
   * 删除cookie
   */
  public static remove(key: string) {
    Cookie.remove(key)
  }
}

export default CookieManager
